WebTextEditor provides a property to add a new command during InitializeToolBar server side event.
In this topic, you will learn how to enable keyboard support.
To add Custom Command during server side event
- Implement InitializeToolBar server side event in the WebTextEditor. Here is the snippet to add the custom command to the Standard toolbar:
C#
Copy Codeprotected void WebTextEditor1_InitializeToolBar(object sender, ISNet.WebUI.WebTextEditor.WebTextEditorToolBarArgs e) { WebTextEditorToolBar tb = e.GetToolBarByCategory(WebTextEditorToolBarCategory.Standard); WebTextEditorToolCommand tbCommand = tb.ToolCommands.CreateNewItem(); tbCommand.Name = "cmdCustomButton"; tbCommand.Text = "Custom Command"; tb.ToolCommands.Add(tbCommand); }
- Implement onToolBarClick client side event to display a message when the newly created command is clicked. Here is the snippet:
Javascript
Copy Codefunction WebTextEditor1_OnToolBarClick(controlId, command, commandSection) { var rte = ISGetObject(controlId); switch (command.Name) { case "cmdCustomButton": alert("Custom button clicked"); break; } }